package com.cq.hd.member.api;

import com.cq.hd.common.response.Result;
import com.cq.hd.member.api.dto.BusinessSubscribeDto;
import com.cq.hd.member.api.dto.BusinessSubscribeUpdateDto;
import com.cq.hd.member.api.vo.BusinessSubscribeVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(value = "hd-o2o-member-service", contextId = "business-subscribe-api")
public interface TbBusinessSubscribeApi {

    // 根据用户id获取订阅商家id列表
    @GetMapping("/member/businessSubscribe/listByUserId")
    Result<List<Long>> listByUserId(@RequestParam("userId") Long userId);

    // 商家订阅和取消订阅
    @PostMapping("/member/businessSubscribe/updateState")
    Result<Object> updateState(@RequestBody BusinessSubscribeUpdateDto businessSubscribeUpdateDto);

    // 根据商家id获取订阅列表
    @PostMapping("/member/businessSubscribe/listByBusinessIds")
    Result<List<BusinessSubscribeVo>> listByBusinessIds(@RequestBody List<Long> businessIds);

    // 根据条件获取订阅商家数据
    @GetMapping("/member/businessSubscribe/listByDto")
    Result<List<BusinessSubscribeVo>> listByDto(@SpringQueryMap BusinessSubscribeDto businessSubscribeDto);

    // 商家订阅人数统计
    @PostMapping("/member/businessSubscribe/getBusinessSubscribeCount")
    Result<Map<Long, Integer>> getBusinessSubscribeCount(@RequestBody List<Long> businessIds);

}
